//
//  MCSystemNoticeTableViewCell.m
//  TLYL
//
//  Created by MC on 2017/6/19.
//  Copyright © 2017年 TLYL01. All rights reserved.
//

#import "MCSystemNoticeTableViewCell.h"

@interface MCSystemNoticeTableViewCell ()
/*
 * 系统公告标题
 */
@property (nonatomic,strong)UILabel * lab_title;
/*
 * 系统公告时间
 */
@property (nonatomic,strong)UILabel * lab_time;
/*
 * 分隔线
 */
@property (nonatomic,strong)UIView * view_line;
/*
 * 箭头
 */
@property (nonatomic,strong)UIImageView * imgV_arrow;


@end

@implementation MCSystemNoticeTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self){
        [self initView];
    }
    return self;
}

- (void)initView{
    
    self.backgroundColor=[UIColor whiteColor];
    
    /*
     * 系统公告标题
     */
    _lab_title =[[UILabel alloc]init];
    _lab_title.textColor=[UIColor grayColor];
    _lab_title.font=[UIFont systemFontOfSize:15];
    _lab_title.text =@"加载中";
    _lab_title.textAlignment=NSTextAlignmentLeft;
    [self  addSubview:_lab_title];
    
    /*
     * 系统公告时间
     */
    _lab_time =[[UILabel alloc]init];
    _lab_time.textColor=[UIColor grayColor];
    _lab_time.font=[UIFont systemFontOfSize:12];
    _lab_time.text =@"加载中";
    _lab_time.textAlignment=NSTextAlignmentLeft;
    [self  addSubview:_lab_time];
    
    /*
     * 画线
     */
    _view_line=[[UIView alloc]init];
    _view_line.backgroundColor=[UIColor grayColor];
    [self addSubview:_view_line];
    
    /*
     * 箭头
     */
    _imgV_arrow=[[UIImageView alloc]init];
    [self addSubview:_imgV_arrow];
    _imgV_arrow.image=[UIImage imageNamed:@"MC_Arrow_test"];

    
    
    [self layOutConstraints];
    
}

-(void)layOutConstraints{
    /*
     * 系统公告标题
     */
    [_lab_title mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.mas_top).offset(10);
        make.right.equalTo(self.mas_right).offset(-10);
        make.left.equalTo(self.mas_left).offset(10);
        make.height.mas_equalTo(20);
    }];
    
    /*
     * 系统公告时间
     */
    [_lab_time mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(_lab_title.mas_bottom).offset(5);
        make.right.equalTo(self.mas_right).offset(-10);
        make.left.equalTo(self.mas_left).offset(10);
        make.height.mas_equalTo(20);
    }];
    
    
    /*
     * 画线
     */
    [_view_line mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(_lab_title.mas_left).offset(0);
        make.right.equalTo(self.mas_right).offset(-10);
        make.height.mas_equalTo(0.8);
        make.bottom.equalTo(self.mas_bottom);
    }];
    
    /*
     * 箭头
     */
    [_imgV_arrow mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.mas_centerY);
        make.right.equalTo(self.mas_right).offset(-10);
        make.height.mas_equalTo(20);
        make.width.mas_equalTo(20);
    }];


}

+(CGFloat)computeHeight:(id)info{
    return 55;
}

-(void)setDataSource:(id)dataSource{
    _dataSource=dataSource;
    
    _lab_title.text=@"这是一条系统公告";
    _lab_time.text=@"2017年06月19日10:16:35";
    
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
